<?php
$nowid = $_POST['nowid'];
require('../../cofd/common.php');
$stmt = $conn->prepare("SELECT * FROM exam_ans WHERE lisid = ?");
$stmt->bind_param("s", $nowid);
$stmt->execute();
$result = $stmt->get_result();
$list = [];
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $list[] = $row;
    }
    $fromexam = $list[0]['fromexam'];
    $stmt = $conn->prepare("SELECT exmatanse FROM exam_page WHERE exmatid = ?");
    $stmt->bind_param("s", $fromexam);
    $stmt->execute();
    $result = $stmt->get_result();
    if ($result->num_rows > 0) {
        while($row2 = $result->fetch_assoc()) {
            $result2 = $row2['exmatanse'];
        }
        echo json_encode(array('code' => 1, 'data' => $list, 'result' => $result2));
    } else {
        echo json_encode(array('code' => 2, 'msg' => '获取数据失败'), JSON_UNESCAPED_UNICODE);
    }
} else {
    echo json_encode(array('code' => 3, 'msg' => '获取数据失败'), JSON_UNESCAPED_UNICODE);
}
$stmt->close();
$conn->close();